from django.db import models


class MusicStyle(models.Model):
    style = models.CharField(max_length=10, verbose_name='歌曲风格', help_text='歌曲风格')

    class Meta:
        verbose_name = '歌曲风格'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.style


class MusicScene(models.Model):
    scene = models.CharField(max_length=10, verbose_name='歌曲场景', help_text='歌曲场景')

    class Meta:
        verbose_name = '歌曲场景'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.scene


class MusicEmotion(models.Model):
    emotion = models.CharField(max_length=10, verbose_name='歌曲情感', help_text='歌曲情感')

    class Meta:
        verbose_name = '歌曲情感'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.emotion


class MusicTheme(models.Model):
    theme = models.CharField(max_length=10, verbose_name='歌曲主题', help_text='歌曲主题')

    class Meta:
        verbose_name = '歌曲主题'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.theme


class MusicSinger(models.Model):
    singer = models.CharField(max_length=20, verbose_name='歌手', help_text='歌手')

    class Meta:
        verbose_name = '歌手'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.singer


class MusicCompose(models.Model):
    compose = models.CharField(max_length=20, verbose_name='作曲家', help_text='作曲家')

    class Meta:
        verbose_name = '作曲家'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.compose


class MusicLyricist(models.Model):
    lyricist = models.CharField(max_length=20, verbose_name='作词者', help_text='作词者')

    class Meta:
        verbose_name = '作词者'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.lyricist


class MusicAlbum(models.Model):
    album = models.CharField(max_length=20, verbose_name='专辑名称', help_text='专辑名称')

    class Meta:
        verbose_name = '专辑名称'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.album


class OneMusicCreate(models.Model):
    '''
    歌曲详细信息
    '''
    LANGUAGE = (
        ('1', '欧美'),
        ('2', '华语'),
        ('3', '日韩'),
        ('4', '粤语'),
        ('5', '小语种'),
    )

    singer = models.ManyToManyField(MusicSinger, verbose_name='歌手', help_text='歌手')
    compose = models.ManyToManyField(MusicCompose, verbose_name='作曲家', help_text='作曲家')
    lyricist = models.ManyToManyField(MusicLyricist, verbose_name='作词者', help_text='作词者', null=True)
    song_name = models.CharField(max_length=20, verbose_name='歌曲名字', help_text='歌曲名字', null=True)
    sub_name = models.CharField(max_length=20, verbose_name='歌曲副标题', help_text='歌曲副标题', null=True)
    lyrics = models.TextField(max_length=3000, verbose_name='歌词', help_text='歌词')

    duration = models.CharField(max_length=6, default='00:00', verbose_name='歌曲时长', help_text='歌曲时长', blank=True)
    album = models.ManyToManyField(MusicAlbum, verbose_name='所属专辑', help_text='所属专辑', blank=True)
    image = models.ImageField(verbose_name='歌曲头像', help_text='歌曲头像', blank=True)
    add_time = models.DateTimeField(auto_now=True, verbose_name='歌曲添加时间', help_text='歌曲添加时间', blank=True)

    languages = models.CharField(max_length=20, verbose_name='语种', help_text='选择语种', choices=LANGUAGE, blank=True)
    style = models.ManyToManyField(MusicStyle, verbose_name='歌曲风格', help_text='歌曲风格', blank=True)
    scene = models.ManyToManyField(MusicScene, verbose_name='歌曲场景', help_text='歌曲场景', blank=True)
    emotion = models.ManyToManyField(MusicEmotion, max_length=10, verbose_name='歌曲情感', help_text='歌曲情感', blank=True)
    theme = models.ManyToManyField(MusicTheme, max_length=10, verbose_name='歌曲主题', help_text='歌曲主题', blank=True)

    is_new = models.BooleanField(default=False, verbose_name='是否是最新', help_text='是否最新', blank=True)
    new_sort = models.CharField(max_length=5, default='0', verbose_name='最新中的排序', help_text='最新中的排序', blank=True)

    play_numbers = models.IntegerField(verbose_name='播放次数', help_text='播放次数', default=0, blank=True)

    is_original = models.BooleanField(default=False, verbose_name='是否原创', help_text='是否原创', blank=True)
    original_sort = models.CharField(max_length=5, default='0', verbose_name='原创中排序', help_text='原创中排序', blank=True)

    is_hot = models.BooleanField(default=False, verbose_name='是否热歌', help_text='是否热歌', blank=True)
    hot_sort = models.CharField(max_length=5, default='0', verbose_name='热歌中排序', help_text='热歌中排序', blank=True)


    class Meta:
        verbose_name = '创建音乐信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.song_name


